package com.neuronbit.businessflow.intellij.model;

import com.neuronbit.businessflow.intellij.model.annotation.HiddenProperty;

import java.io.Serializable;

/**
 * The type Decision.
 */
public class Decision extends JavaMethodTask implements Serializable {
    private Task whenTrue;
    private Task whenFalse;

    /**
     * Instantiates a new Decision.
     */
    public Decision() {
        super(null, "Decision", NodeType.DECISION);
    }

    /**
     * Instantiates a new Decision.
     *
     * @param id   the id
     * @param name the name
     */
    public Decision(String id, String name) {
        this(id, name, null, null);
    }

    /**
     * Instantiates a new Decision.
     *
     * @param id        the id
     * @param name      the name
     * @param whenTrue  the when true
     * @param whenFalse the when false
     */
    public Decision(String id, String name, Task whenTrue, Task whenFalse) {
        super(id, name, NodeType.DECISION);
        this.whenTrue = whenTrue;
        this.whenFalse = whenFalse;
    }

    /**
     * Sets when true.
     *
     * @param whenTrue the when true
     */
    @HiddenProperty
    public void setWhenTrue(Task whenTrue) {
        this.whenTrue = whenTrue;
    }

    /**
     * Sets when false.
     *
     * @param whenFalse the when false
     */
    @HiddenProperty
    public void setWhenFalse(Task whenFalse) {
        this.whenFalse = whenFalse;
    }

    /**
     * Gets when true.
     *
     * @return the when true
     */
    public Task getWhenTrue() {
        return whenTrue;
    }

    /**
     * Gets when false.
     *
     * @return the when false
     */
    public Task getWhenFalse() {
        return whenFalse;
    }
}
